import 'package:fashion_app/pages/homePages/mock.dart';
import 'package:flutter/material.dart';

// 定义颜色常量
const Color textPrimaryColor = Color(0xFF333333);
const Color textSecondaryColor = Color(0xFF999999);

// 定义文本样式常量
const TextStyle primaryTextStyle = TextStyle(
  fontSize: 20,
  fontWeight: FontWeight.w500,
  letterSpacing: 0,
  color: textPrimaryColor,
);

const TextStyle secondaryTextStyle = TextStyle(
  fontSize: 14,
  fontWeight: FontWeight.w500,
  letterSpacing: 0,
  color: textSecondaryColor,
);

class UserGreeting extends StatelessWidget {
  // 提取获取问候语的方法
  String getGreeting() {
    final hour = DateTime.now().hour;
    if (hour < 12) {
      return '早上好';
    } else if (hour < 18) {
      return '下午好';
    } else {
      return '晚上好';
    }
  }

  @override
  Widget build(BuildContext context) {
    final greeting = getGreeting();
    final user_name = homeData.user_name;

    return Semantics(
      label: '用户问候区域',
      child: Container(
        height: 150,
        padding: EdgeInsets.only(top: 16),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center, // 垂直方向上让子元素靠底部排列
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('$greeting $user_name', style: primaryTextStyle),
                  Text('今天适合穿什么呢？', style: secondaryTextStyle),
                ],
              ),
            ),
            GestureDetector(
              onTap: () {
                
                print('点击了用户形象');
                // 此处可添加跳转到新页面的逻辑，示例中使用 Navigator.push 进行页面跳转
                // Navigator.push(context, MaterialPageRoute(builder: (context) => NewPage()));
              },
              child: Image.asset(
                // 这里需要替换为实际的图片路径
                'lib/assets/images/person.png',
                width: 128,
                height: 128,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
